<#assign base=request.contextPath />
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="${base}/css/bootstrap.min.css" />
		<script type="text/javascript" src="${base}/js/jquery-1.12.0.min.js"></script>
		<link rel="stylesheet" href="${base}/css/common.css" />
		<script type="text/javascript" src="${base}/js/common.js"></script>
	</head>

	<body>
		<div class="container-fluid">
			<select id="group" class="form-control mar_top"> 
 				<option>......</option>
 				<#list groups as item>
 				<option value="${item.id}">${item.name}</option>	
 				</#list>
			</select>
			
			<div class="choose_con mar_top">
				<a class="a_color">照片</a>
				<a class="a_color">语音</a>
			</div> 
			<div class="msg_area form-control " id="content" contenteditable="true" disabled>
					请先选择一个组
			</div>
			<div class="form-group login_reg_btn">
				<button id="submit" class="btn btn-primary">咨询</button>
			</div>
		</div>
		<script>
			var group;
		
			$(document).ready(function() {
				$("#submit").click(function() {
					if($("#content").html()=='') return;
					
					$.post("post/content",{
						"group":group,
						"content":$("#content").html()
					},function(res){
					    var r = jQuery.parseJSON(res);
						
						if(r.status == undefined)  alert("咨询成功");
						else  alert("咨询失败");
					});
					
				
				});
			});
			
			$("#group").change(function() {
				if($(this).prop("selectedIndex") != 0){
					$("#content").removeAttr("disabled");
					$("#content").empty();
					group = $(this).val();
				}else{
					$("#content").html("请先选择一个组");
					$("#content").attr("disabled","disabled");
				
				}
			
			});
			
		</script>
	</body>

</html>